package com.xingkeduo.business.user.controller;

import com.xingkeduo.business.transformation.json.ConsumerJTO;
import com.xingkeduo.business.user.domain.ConsumerDomain;
import com.xingkeduo.pojo.query.ConsumerQO;
import com.xingkeduo.util.pojo.base.BaseController;
import com.xingkeduo.util.tool.ReturnUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: 消费者第三方信息
 * @Author:gaozifeng
 * @Date 2019/2/27 18:23
 **/
@RestController
@RequestMapping("/consumer/third")
public class ConsumerThirdController extends BaseController {

    @Autowired
    private ConsumerDomain consumerDomain;

    @GetMapping(value = "/{userParam:.+}")
    public String userDetail(@PathVariable String userParam){
        returnUtil = new ReturnUtil();
        try {
            ConsumerQO consumerQO =ConsumerJTO.createQueryForPrimary(userParam);

            return returnUtil.getSuccess(ConsumerJTO.toJson(consumerDomain.userDetail(consumerQO)));
        } catch (Throwable t) {
            return dealException(t, returnUtil);
        }
    }
}
